package com.usian.login.controller;

import com.usian.common.pojo.ResultVo;
import com.usian.common.pojo.User;
import com.usian.login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/user")
public class LoginController {
    @Autowired
    private LoginService loginService;

    @RequestMapping("send")
    public ResultVo login(String phone) throws Exception {
        return loginService.sendCode(phone);

    }
    @RequestMapping("userLogin")
    public ResultVo userLogin(String phone,String code) throws Exception {
        return loginService.userLogin(phone,code);

    }
    @RequestMapping("save")
    public ResultVo save(@RequestBody User user){
        return loginService.save(user);
    }
}
